package com.runmi.webchat.aftersale.web.setup.controller;

import java.io.IOException;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.runmi.webchat.aftersale.web.base.BaseController;
import com.runmi.webchat.aftersale.web.setup.service.SetupOrderService;
import com.runmi.webchat.aftersale.web.setup.vo.SetupOrderResVo;
import com.runmi.webchat.aftersale.web.shop.service.ShopManageService;
import com.runmi.webchat.aftersale.web.shop.vo.ShopManageIndexReqVo;

@Controller
@RequestMapping(value = "/admin/setup")
public class SetupOrderController extends BaseController{
	
	@Autowired
	private SetupOrderService setupOrderService;

	@RequestMapping(value = "/index")
	public ModelAndView index(HttpServletRequest request,HttpServletResponse response,SetupOrderResVo model){
		ModelAndView mav = new ModelAndView("/setup/index");		
		setupOrderService.index(model);
    	mav.addObject("model", model);
        return mav;
		//return "/customer/Customer/seach";
	}
	
	@RequestMapping(value = "/exportXls")
	public void exportXls(
			HttpServletRequest request,HttpServletResponse response,
			SetupOrderResVo model
			) throws ServletException, IOException{
			Integer userId=  this.getUserId(request,response);
			if(null==userId){
				return;
			}
			setupOrderService.exportXls(
		  			request, response, 
		  			model);		  	
	}
	
	@RequestMapping(value = "/changeStatus")
	@ResponseBody
	public Map<String,String> changeStatus(HttpServletRequest request,HttpServletResponse response,Integer id,Byte status){
	
		Map<String,String> result=setupOrderService.changeStatus(this.getUserInfo(request, response),id,status);
		return result;
	}
}
